      *> File Name     000014_NativeTypes.cbl.
      *> Description   A quick tour of COBOL's predefined usages for
      *>               .NET native types.
      *> Project Type  Console Application.
      *> CodePlex URL  http://cobol.codeplex.com
 
       program-id.   Main.
       repository.
           class sys-console as "System.Console"
           .
       working-storage section.
       01  fmt      string.
       01  i        binary-long.
       01  i-max    binary-long.
       01  kind     string.
       01  names    string occurs any.
       01  objects  object occurs any.
       procedure division.
           move "Predefined Usages for .NET Native Types"
               to sys-console::"Title"
 
           set content of names to (
               "condition-value"
               "character"
               "binary-char"
               "binary-short"
               "binary-long"
               "binary-double"
               "decimal"
               "binary-char unsigned"
               "binary-short unsigned"
               "binary-long unsigned"
               "binary-double unsigned"
               "float-short"
               "float-long"
               "string"
               "object"
           )
 
           set content of objects to (
               condition-value::"New" as object
               character::"Parse"("A")
               binary-char::"MinValue"
               binary-short::"MinValue"
               binary-long::"MinValue"
               binary-double::"MinValue"
               decimal::"MinValue"
               binary-char unsigned::"MaxValue"
               binary-short unsigned::"MaxValue"
               binary-long unsigned::"MaxValue"
               binary-double unsigned::"MaxValue"
               float-short::"MinValue"
               float-long::"MinValue"
               string::"Join"("-", "COBOL", "59")
               object::"New"
           )
 
           move "{0,-24}{1,-16}{2,-7}{3}" to fmt
 
           display string::"Format"(fmt, "Predefined Usage",
               ".Net Type", "Kind*", "Example (ToString)")::"ToUpper"
 
           move 1 to i
           move objects::"Length" to i-max
 
           perform until i > i-max
               if objects(i)::"GetType"::"IsValueType" then
                   move "Value" to kind
               else
                   move "Ref" to kind
               end-if
               display string::"Format"(fmt, names(i),
                   objects(i)::"GetType", kind, objects(i))
               add 1 to i
           end-perform
 
           display " * Kind: Value = value type; Ref = reference type."
 
           display "Press any key to continue . . . " no advancing
           invoke sys-console::"ReadKey"(true)
           .
       end program   Main.